package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.PurOrderMapper;
import com.ruoyi.system.domain.PurOrder;
import com.ruoyi.system.service.IPurOrderService;
import com.ruoyi.common.core.text.Convert;

/**
 * 采购订单Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-16
 */
@Service
public class PurOrderServiceImpl implements IPurOrderService 
{
    @Autowired
    private PurOrderMapper purOrderMapper;

    /**
     * 查询采购订单
     * 
     * @param orderId 采购订单主键
     * @return 采购订单
     */
    @Override
    public PurOrder selectPurOrderByOrderId(Long orderId)
    {
        return purOrderMapper.selectPurOrderByOrderId(orderId);
    }

    /**
     * 查询采购订单列表
     * 
     * @param purOrder 采购订单
     * @return 采购订单
     */
    @Override
    public List<PurOrder> selectPurOrderList(PurOrder purOrder)
    {
        return purOrderMapper.selectPurOrderList(purOrder);
    }

    /**
     * 新增采购订单
     * 
     * @param purOrder 采购订单
     * @return 结果
     */
    @Override
    public int insertPurOrder(PurOrder purOrder)
    {
        purOrder.setCreateTime(DateUtils.getNowDate());
        return purOrderMapper.insertPurOrder(purOrder);
    }

    /**
     * 修改采购订单
     * 
     * @param purOrder 采购订单
     * @return 结果
     */
    @Override
    public int updatePurOrder(PurOrder purOrder)
    {
        purOrder.setUpdateTime(DateUtils.getNowDate());
        return purOrderMapper.updatePurOrder(purOrder);
    }

    /**
     * 批量删除采购订单
     * 
     * @param orderIds 需要删除的采购订单主键
     * @return 结果
     */
    @Override
    public int deletePurOrderByOrderIds(String orderIds)
    {
        return purOrderMapper.deletePurOrderByOrderIds(Convert.toStrArray(orderIds));
    }

    /**
     * 删除采购订单信息
     * 
     * @param orderId 采购订单主键
     * @return 结果
     */
    @Override
    public int deletePurOrderByOrderId(Long orderId)
    {
        return purOrderMapper.deletePurOrderByOrderId(orderId);
    }
}
